#ifndef _CAN_H_
#define _CAN_H_

#include "gd32f30x.h"

#define CAN0_NUMBER 		4
#define CAN1_NUMBER 		20

extern can_trasnmit_message_struct	CAN0_TxMessage[CAN0_NUMBER];		
extern can_trasnmit_message_struct	CAN1_TxMessage[CAN1_NUMBER];	

extern can_receive_message_struct	CAN0_RxMessage;		
extern can_receive_message_struct	CAN1_RxMessage;

extern uint16_t	CAN0_AircdRxResetTime1;
extern uint16_t	CAN0_AircdRxResetTime2;
extern uint16_t	CAN0_AircdRxResetTime3;
extern uint16_t	CAN0_AircdRxResetTime4;

extern uint16_t	CAN1_AircdRxResetTime1;
extern uint16_t	CAN1_AircdRxResetTime2;
extern uint16_t	CAN1_AircdRxResetTime3;

extern uint16_t	CAN0_TXPointer;
extern uint16_t	CAN1_TXPointer;	

void CAN_Config(void);

void CAN0_PDO1Package(can_trasnmit_message_struct *TxMessage);
void CAN0_PDO2Package(can_trasnmit_message_struct *TxMessage);
void CAN0_PDO3Package(can_trasnmit_message_struct *TxMessage);
void CAN0_PDO4Package(can_trasnmit_message_struct *TxMessage);

void CAN0_TXPackage(void);
void CAN0_RXDataApp(void);

void CAN1_PDO1Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO2Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO3Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO4Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO5Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO6Package(can_trasnmit_message_struct *TxMessage);
void CAN1_PDO7Package(can_trasnmit_message_struct *TxMessage);
void CAN1_BMS1Package(can_trasnmit_message_struct *TxMessage);
void CAN1_BMS2Package(can_trasnmit_message_struct *TxMessage);
void CAN1_BMS3Package(can_trasnmit_message_struct *TxMessage);
void CAN1_VersionPackage(can_trasnmit_message_struct *TxMessage);

void CAN1_TXPackage(void);
void CAN1_RXDataApp(void);

#endif


